home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 January / Disc 3 / Amethyst.iso / live / usr / lib / rpm-3.0.6 / vpkg-provides2.sh < prev   
Encoding:
Linux/UNIX/POSIX Shell Script  |  2001-04-06  |  2.4 KB  |  116 lines

  1. #!/bin/sh
  2.  
  3.  
  4. PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd
  5. export PATH
  6.  
  7. IGNORE_DIRS='@'
  8.  
  9. date=`date`
  10. hostname=`uname -n`
  11. osname=`uname -s`
  12.  
  13. # programs we run
  14.  
  15. find_provides=/usr/lib/rpm/find-provides
  16. find_requires=/usr/lib/rpm/find-requires
  17. #find_provides=/devel/kestes/vendorc/tools/solaris.prov
  18. #find_requires=/devel/kestes/vendorc/tools/solaris.req
  19. u_pkg=/devel/kestes/vendorc/rpm/scripts/u-pkg.sh 
  20.  
  21. # where we write output
  22. spec_filedir=/tmp
  23. provides_tmp=/tmp/provides.$$
  24. requires_tmp=/tmp/requires.$$
  25.  
  26.  
  27. for pkg in `$u_pkg list_all_packages`
  28. do
  29.  
  30. # find OS pkg information
  31.  
  32. spec_filename=$spec_filedir/$pkg
  33.  
  34. veryify_cmd=`$u_pkg print_cmd package_version $pkg | sed -e "s/\\$1/$pkg/" `
  35.  
  36. pkg_version=`$u_pkg package_version $pkg `
  37.  
  38.  
  39. # find all the dependencies
  40.  
  41. $u_pkg list_all_files_in_package $pkg | egrep -v \'$IGNORE_DIRS\' | \
  42.     $find_provides | sed -e 's/^/Provides: /' > $provides_tmp
  43.  
  44. $u_pkg list_all_files_in_package $pkg | egrep -v \'$IGNORE_DIRS\' | \
  45.     $find_requires | sed -e 's/^/Requires: /' > $requires_tmp
  46.  
  47. # create the spec file
  48.  
  49. rm -f $spec_filename
  50.  
  51. echo >> $spec_filename
  52.  
  53. cat $provides_tmp | sort -u >> $spec_filename
  54.  
  55. echo >> $spec_filename
  56.  
  57. cat $requires_tmp | sort -u >> $spec_filename
  58.  
  59. echo >> $spec_filename
  60.  
  61.  
  62. # Output the rest of the spec file.  It is a template stored in this
  63. # here file.
  64.  
  65.  
  66. cat >> $spec_filename <<_EIEIO_
  67. Name: vpkg-$pkg
  68. Version: $pkg_version
  69.  
  70. %description
  71. This is a virtual RPM package.  It contains no actual files.  It uses the
  72. \`Provides' token from RPM 3.x and later to list many of the shared libraries
  73. and interpreters that are part of the base operating system and associated
  74. subsets for $osname.
  75.  
  76. This virtual package was constructed based on the vendor/system software
  77. installed on the $osname machine named $hostname, as of the date
  78. $date.  It is intended to supply dependency 
  79. information about the OS package: $pkg, version: $pkg_version,
  80.  
  81.  
  82. %prep
  83. # nothing to do
  84.  
  85. %build
  86. # nothing to do
  87.  
  88. %install
  89. # nothing to do
  90.  
  91. %clean
  92. # nothing to do
  93.  
  94.  
  95. %verifyscript
  96.  
  97. PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:/usr/bsd:/usr/local/bin
  98. export PATH
  99.  
  100. expected_version='$pkg_version'
  101. current_version=\`$veryify_cmd\`
  102.  
  103. if [ \$expected_version -ne \$current_version ]; then
  104.     echo "RPM virtual package does not match OS pkg: $pkg" >&2
  105.     echo "installed packge version: \$current_verion" >&2
  106.     echo "expected package version: \$expected_version" >&2
  107.     exit 9
  108. fi
  109.  
  110. %files
  111.  
  112. _EIEIO_
  113.  
  114. done  
  115.  
  116.